<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <title>addAddress</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="css/mui.min.css" rel="stylesheet" />
    <style type="text/css">
        p {
            margin: 0;
            padding: 0;
        }
        
        .mui-content {
            background: white!important;
        }
        
        body,
        input,
        select,
        textarea {
            font-size: 14px;
        }
        
        .mui-title {
            text-align: left;
        }
        
        .mui-input-row {
            clear: none;
        }
        
        .mui-input-row label {
            width: 25%;
        }
        
        .mui-input-row label~input,
        .mui-input-row label~select,
        .mui-input-row label~textarea {
            width: 75%;
        }
        
        .mui-input-row .mui-input-row label {
            width: 100%;
        }
        
        .mui-checkbox.mui-left input[type=checkbox],
        .mui-radio.mui-left input[type=radio] {
            left: 0;
        }
        
        .mui-checkbox.mui-left label,
        .mui-radio.mui-left label {
            padding-left: 40px;
            padding-right: 33px;
        }
        
        .mui-content p {
            height: 40px;
            line-height: 40px;
            padding-left: 15px;
            font-size: 14px;
            background-color: #EFEFF4;
        }
        
        .pr0 label {
            padding: 11px 0 11px 15px;
            width: 36%;
        }
        
        .pr0.mui-input-row label~input,
        .mui-input-row label~select,
        .mui-input-row label~textarea {
            width: 64%;
        }
        
        .mui-icon.mui-pull-right {
            font-size: 18px;
        }
    </style>
</head>

<body>
    <form class="mui-input-group" id="commonForm">
        <header class="mui-bar mui-bar-nav">
            <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
            <h1 class="mui-title">{{title}}</h1>
            <a class="mui-icon mui-pull-right" @click="submitFun()">保存</a>
        </header>
        <div class="mui-content">
            <!--编辑-->
            <div v-if="status">
                <input type="hidden" name="addressId" id="addressId" :value="dataId" />
                <p>联系人</p>
                <div class="mui-input-row">
                    <label>姓名:</label>
                    <input type="text" class="mui-input-clear" name="name" :value="dataObj.name" placeholder="请填写收货人的姓名">
                </div>
                <div class="mui-input-row">
                    <label></label>
                    <div class="mui-input-row mui-radio mui-pull-left mui-left">
                        <label>先生</label>
                        <input type="radio" name="gender" value="0" checked="">
                    </div>
                    <div class="mui-input-row mui-radio mui-pull-left mui-left">
                        <label>女士</label>
                        <input type="radio" name="gender" value="1">
                    </div>
                </div>
                <div class="mui-input-row">
                    <label>手机:</label>
                    <input type="number" class="mui-input-phone" name="phonenumber" :value="dataObj.phonenumber" placeholder="请填写收货手机号码">
                </div>
                <p>收货地址</p>
                <div class="mui-input-row pr0">
                    <label>小区/大厦/学校:</label>
                    <input type="text" class="mui-input-phone" name="building" :value="dataObj.building" placeholder=" 点击选择">
                </div>
                <div class="mui-input-row pr0">
                    <label>楼号-门牌号:</label>
                    <input type="text" class="mui-input-phone" name="doorplate" :value="dataObj.doorplate" placeholder="例:16号楼427室">
                </div>
            </div>
            <!--新增-->
            <div v-if="!status">
                <p>联系人</p>
                <div class="mui-input-row">
                    <label>姓名:</label>
                    <input type="text" class="mui-input-clear" name="name" placeholder="请填写收货人的姓名">
                </div>
                <div class="mui-input-row">
                    <label></label>
                    <div class="mui-input-row mui-radio mui-pull-left mui-left">
                        <label>先生</label>
                        <input type="radio" name="gender" value="0" checked="">
                    </div>
                    <div class="mui-input-row mui-radio mui-pull-left mui-left">
                        <label>女士</label>
                        <input type="radio" name="gender" value="1">
                    </div>
                </div>
                <div class="mui-input-row">
                    <label>手机:</label>
                    <input type="number" class="mui-input-phone" name="phonenumber" placeholder="请填写收货手机号码">
                </div>
                <p>收货地址</p>
                <div class="mui-input-row pr0">
                    <label>小区/大厦/学校:</label>
                    <input type="text" class="mui-input-phone" name="building" placeholder=" 点击选择">
                </div>
                <div class="mui-input-row pr0">
                    <label>楼号-门牌号:</label>
                    <input type="text" class="mui-input-phone" name="doorplate" placeholder="例:16号楼427室">
                </div>
            </div>
        </div>
    </form>
</body>
<script src="js/jquery-1.11.0.js" type="text/javascript" charset="utf-8"></script>
<script src="js/mui.min.js"></script>
<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
<script src="js/commonVue.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    var commonAll = new commonFun('commonForm', {
        "getDataUrl": "/address/getByAddressId",
        "saveUrl": "/address/update"
    }, false, 'addressId')
    commonAll.commonFormInit();
    commonAll.webviewShow(); // 子页面需要调用


    //		var vm = new Vue({
    //			el: "#formContent",
    //			data: {
    //				editData: {},
    //				status: false,
    //				typeId: ''
    //			},
    //			mounted: function() {
    //				this.init()
    //			},
    //			methods: {
    //				init: function() {
    //					//mui.init();
    //					mui.plusReady(function() {
    //						var self = plus.webview.currentWebview(); //获取当前窗体对象
    //						vm.typeId = self.rid; //接受上一页面传过来的值；
    //						console.log('接收到类型ID值:' + vm.typeId)
    //						// 判断状态类型  编辑/新增
    //						if(vm.typeId != null) { //  编辑   ps: null -> 新增
    //							vm.status = true;
    //							vm.getData('/address/getByAddressId', 'post', vm.typeId); // 拉去对应ID的数据
    //						}
    //					});
    //
    //				},
    //				getData: function(path, subtype, addressId) {
    //					mui.ajax(server + path, {
    //						dataType: 'json',
    //						type: subtype,
    //						data: {
    //							addressId: addressId
    //						},
    //						success: function(res) {
    //							console.log(res)
    //							vm.editData = res;
    //						},
    //						error: function(type) {
    //							console.log(type)
    //						}
    //					})
    //				},
    //				submitFun: function(savePath) {
    //					mui.ajax(server + savePath, {
    //						dataType: 'json',
    //						type: 'post',
    //						data: $('#commonForm').serialize(),
    //						success: function(res) {
    //							console.log(res);
    //							mui.plusReady(function() {
    //								var current = plus.webview.currentWebview();
    //								var address = plus.webview.getWebviewById('address.html'); //查找指定标识的窗口  父页面
    //								mui.fire(address, "pullRefresh"); //触发首页的 pageflowrefresh 方法
    //								// 关闭页面写在自定义函数下面   可以解决  关闭login后 → 显示的是用户信息页面 → 显示的是首页
    //								plus.webview.close(current, 'pop-out');
    //							})
    //						},
    //						error: function(type) {
    //							console.log(type)
    //						}
    //					})
    //				}
    //			}
    //		})
</script>

</html>